package com.gu.qqdemo.adapter;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;

import com.gu.qqdemo.utils.app.BaseFragment;

public class ViewPageAdapter extends FragmentPagerAdapter {
    private BaseFragment[] bfg;
    private String[] tables;

    public ViewPageAdapter(FragmentManager fm, BaseFragment[] bfg, String[] tables) {
        super(fm);
        this.bfg = bfg;
        this.tables = tables;
    }


    @Override
    public Fragment getItem(int position) {
        return bfg[position];
    }

    @Override
    public int getCount() {
        return bfg.length;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return tables[position];
    }

    @Override
    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
        return view == object;
    }

}
